package org.scau.studentevaluation.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.scau.studentevaluation.config.global.log.WebLog;
import org.scau.studentevaluation.entity.dos.OrganizationDO;
import org.scau.studentevaluation.entity.dos.UserDO;
import org.scau.studentevaluation.entity.query.OrganizationQurey;
import org.scau.studentevaluation.entity.vo.OrganizationVO;
import org.scau.studentevaluation.service.IOrganizationService;
import org.scau.studentevaluation.service.ImportMapperService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author: x1aolone
 * @Date: 2020/8/19 16:07
 */
@Slf4j
@RestController
@Api("Organization控制器")
@WebLog("Organization控制器")
public class OrganizationController {

    // Controller -> Service -> DAO
    @Autowired
    private IOrganizationService organizationService;

    // localhost:7003/organization/findOrganization/3
    // post delete get put
    // restful
    //
    @ApiOperation("查询")
    @GetMapping("/findOrganization/{userId}")
    public String findOrganization (String userId) {
        String organization =  organizationService.findOrganization(userId);
        if(organization == null) {
            // 数据库里面没有的话，统一返回学生会
            organization = "学生会";
        }
        return organization;
    }
}
